package com.grass.p019lv.game;

import android.webkit.WebView;
import android.widget.LinearLayout;
import com.androidsa.bttsddka.R;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.p015ui.BaseActivity;
import com.grass.p019lv.AndroidInterface;
import com.grass.p019lv.databinding.ActivityGameWebViewBinding;
import com.grass.p019lv.game.view.GameDialogUtils;
import com.just.agentweb.AgentWeb;
import com.just.agentweb.MiddlewareWebChromeBase;

/* renamed from: com.grass.lv.game.GameWebViewActivity */
public class GameWebViewActivity extends BaseActivity<ActivityGameWebViewBinding> {
    private AgentWeb agentWeb;
    public String gameUrl;
    public String title;

    @Override // com.androidx.p013lv.base.p015ui.BaseActivity, p012cn.bingoogolapple.swipebacklayout.BGASwipeBackHelper.Delegate
    public boolean isSupportSwipeBack() {
        return false;
    }

    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public int setLayout() {
        requestWindowFeature(1);
        getWindow().setFlags(1024, 1024);
        return R.layout.activity_game_web_view;
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initView() {
        super.initView();
        String stringExtra = getIntent().getStringExtra(Key.WEB_VIEW_URL);
        this.gameUrl = stringExtra;
        openUrl(stringExtra);
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initData() {
        super.initData();
    }

    @Override // androidx.activity.ComponentActivity, com.androidx.p013lv.base.p015ui.BaseActivity
    public void onBackPressed() {
        GameDialogUtils.getInstance().createGameWebViewDialog(this, new GameDialogUtils.OnConfirmListener() {
            /* class com.grass.p019lv.game.GameWebViewActivity.C30271 */

            @Override // com.grass.p019lv.game.view.GameDialogUtils.OnConfirmListener
            public void onConfirm() {
                GameWebViewActivity.this.finish();
            }
        });
    }

    /* access modifiers changed from: protected */
    @Override // androidx.fragment.app.FragmentActivity
    public void onPause() {
        AgentWeb agentWeb2 = this.agentWeb;
        if (agentWeb2 != null) {
            agentWeb2.getWebLifeCycle().onPause();
        }
        super.onPause();
    }

    /* access modifiers changed from: protected */
    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, com.androidx.p013lv.base.p015ui.BaseActivity
    public void onDestroy() {
        AgentWeb agentWeb2 = this.agentWeb;
        if (agentWeb2 != null) {
            agentWeb2.getWebLifeCycle().onDestroy();
        }
        super.onDestroy();
    }

    /* access modifiers changed from: protected */
    @Override // androidx.fragment.app.FragmentActivity
    public void onResume() {
        AgentWeb agentWeb2 = this.agentWeb;
        if (agentWeb2 != null) {
            agentWeb2.getWebLifeCycle().onResume();
        }
        super.onResume();
    }

    private void callJS() {
        this.agentWeb.getJsAccessEntrace().quickCallJs("callJS");
    }

    private void openUrl(String str) {
        this.agentWeb = AgentWeb.with(this).setAgentWebParent(((ActivityGameWebViewBinding) this.binding).linWeb, new LinearLayout.LayoutParams(-1, -1)).useDefaultIndicator().useMiddlewareWebChrome(new MiddlewareWebChromeBase() {
            /* class com.grass.p019lv.game.GameWebViewActivity.C30282 */

            @Override // com.just.agentweb.WebChromeClientDelegate
            public void onReceivedTitle(WebView webView, String str) {
                super.onReceivedTitle(webView, str);
            }
        }).createAgentWeb().ready().mo26876go(str);
        callAndroid();
    }

    private void callAndroid() {
        this.agentWeb.getJsInterfaceHolder().addJavaObject("android", new AndroidInterface(this.agentWeb, this));
    }
}
